#!/usr/bin/perl

$str=`/usr/local/nagios/libexec/check_nrpe -H $ARGV[0] -c CheckDriveSize -a ShowAll Drive=$ARGV[1]: | awk '{print$5}' | sed 's/.*=//' `;

if(index($str,"K") > 0){
  $str=substr($str,0,index($str,"K"));
  $str=$str/(1024*1024);
};

if(index($str,"M") > 0){
  $str=substr($str,0,index($str,"M"));
  $str=$str/1024;
};

if(index($str,"G") > 0){
  $str=substr($str,0,index($str,"G"));
};

if( $str < 0.0001 ){
  $str = 0;
};

print $str;
print "\n";
